const { Sequelize, Model } = require('sequelize')
const { sequelize } = require('../../core/db')

class Partner extends Model {}

Partner.init({
  id: {
    type: Sequelize.INTEGER,
    autoIncrement: true,
    primaryKey: true
  },
  linkName: Sequelize.STRING(30),
  linkUrl: Sequelize.STRING(200),  
  imgSrc: Sequelize.STRING(200),
  orderNum: {
    type: Sequelize.INTEGER,
    defaultValue: 1
  }
}, {
  sequelize
})

Partner.sync().then(() => {
  return Partner.bulkCreate([
    { linkName: '', linkUrl: '', imgSrc: '/images/partner/logo-1.png', orderNum: 1},
    { linkName: '', linkUrl: '', imgSrc: '/images/partner/logo-2.png', orderNum: 2},
    { linkName: '', linkUrl: '', imgSrc: '/images/partner/logo-3.png', orderNum: 3},
    { linkName: '', linkUrl: '', imgSrc: '/images/partner/logo-4.png', orderNum: 4},
    { linkName: '', linkUrl: '', imgSrc: '/images/partner/logo-5.png', orderNum: 5},
    { linkName: '', linkUrl: '', imgSrc: '/images/partner/logo-6.png', orderNum: 6},
    { linkName: '', linkUrl: '', imgSrc: '/images/partner/logo-7.png', orderNum: 7},
    { linkName: '', linkUrl: '', imgSrc: '/images/partner/logo-8.png', orderNum: 8},
    { linkName: '', linkUrl: '', imgSrc: '/images/partner/logo-9.png', orderNum: 9},
    { linkName: '', linkUrl: '', imgSrc: '/images/partner/logo-10.png', orderNum: 10}
  ])
})

module.exports = Partner